<?php
defined('APP_PATH') or die ('Unauthorized access');

class Model_Category extends Model
{
	private $_cache = null;
	const CACHE_LIFETIME = 7200;
	public function __construct()
	{
		$this->Config(array('table'=>'websys_notebook_category'));
		$this->_cache = Load::Cache();
		$this->_cache->lifetime = self::CACHE_LIFETIME;
	}
	
	public function getCategory()
	{
		$key = 'blog_category';
		$category = '';
		if(!$this->_cache->check($key)){
			$where[] = array('is_blog','=',1);
			$category = $this->fetchAll($where);
			$this->_cache->save($key,$category);
		}else{
			$category = $this->_cache->load($key);
		}
		return $category;
		
	}
	
	
}